Repository navigation
fix(relinker): accept the input's directory as a module directory - #3850
Merged
oneandonlydean merged 2 commits intoOct 12, 2026
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
Windows test of this PR with Hades (PPSA03355), as asked in #2724: Windows 10, MinGW/Ninja Release build of
Not tested: Linux, and a run without AI-assisted (Claude Code). |
9 tasks done
11 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
--module-dir .did not work for modules kept next to the executable, the layout Hades (PPSA03355) uses forlibfmod.prxandlibfmodstudio.prx, which it loads withdlopen("/app0/libfmod.prx")(#2724). Three problems:ELF is not a shared module, reported in Hades (PPSA03355) on Windows: start-up faults in the title's own libc.prx before any file is opened #2724). The input executable is now skipped when scanning module directories.app0/./<name>.guest.prxas output, runtime and LinuxDT_NEEDEDpath. They now getapp0/<name>.guest.prx, which is wheredlopenlooks (<requested path>.guest.prx,DynamicLoader.cpp:131). One helper builds the path for both uses.(root / ".").lexically_normal()keeps a trailing separator, so the directory did not match the module's parent and the module was not treated as runtime-loaded (it went into LinuxDT_NEEDEDand was started without start arguments). fix(relinker): normalize additional module directory paths #3509 fixes that normalization; this branch carries its commit unchanged.Non-ELF files are still skipped, and the scan stays non-recursive, so
sce_sys/and dump folders are not walked (#2708).USAGE.mddocuments..Tested
Ubuntu 24.04, GCC 13.3.0, relinker-only build (
-DANYPS5_RELINKER_ONLY=ON -DBUILD_TESTING=ON, Release): 114/114 tests pass.guest_module_dirgains two cases, run for both Linux and Windows output:--module-dir .: it is written toapp0/root.prx.guest.prx, stays out ofDT_NEEDEDon Linux, and exports__aps5_guest_initializeon Windows;DT_NEEDEDis$ORIGIN/app0/needed.prx.guest.prx.input.elf: Invalid string or symbol table), and with only the scan fix the path is$ORIGIN/app0/./root.prx.guest.prx.relinker --windows --module-dir . game/eboot.elf app.exewithlibfmod.prxnext toeboot.elf: it writesgame/app0/libfmod.prx.guest.prx. A second Linux run with the output.elfinside the module directory stops with the existing "Executable output would overwrite an input module" error. The output is deliberately not skipped by the scan, since skipping it would bypass that guard when the output path names a real module. An earlier relinked output left in a module directory is scanned like any other ELF there (true of every--module-dir), so the output belongs outside the game directory.tools/check_conventions.pyfrommainpasses on this branch with this title and body.Not tested: Windows host (the
.exerun in the test only runs on Windows) or the title itself. I don't have a Hades dump. The reporter's workaround in #2724 (copying the.guest.prxfiles toapp0/) is the layout this change produces.Checklist
What
--module-dir .did not work for modules kept next to the executable, the layout Hades (PPSA03355) uses forlibfmod.prxandlibfmodstudio.prx, which it loads withdlopen("/app0/libfmod.prx")(#2724). Three problems:ELF is not a shared module, reported in Hades (PPSA03355) on Windows: start-up faults in the title's own libc.prx before any file is opened #2724). The input executable is now skipped when scanning module directories.app0/./<name>.guest.prxas output, runtime and LinuxDT_NEEDEDpath. They now getapp0/<name>.guest.prx, which is wheredlopenlooks (<requested path>.guest.prx,DynamicLoader.cpp:131). One helper builds the path for both uses.(root / ".").lexically_normal()keeps a trailing separator, so the directory did not match the module's parent and the module was not treated as runtime-loaded (it went into LinuxDT_NEEDEDand was started without start arguments). fix(relinker): normalize additional module directory paths #3509 fixes that normalization; this branch carries its commit unchanged.Non-ELF files are still skipped, and the scan stays non-recursive, so
sce_sys/and dump folders are not walked (#2708).USAGE.mddocuments..Tested
Ubuntu 24.04, GCC 13.3.0, relinker-only build (
-DANYPS5_RELINKER_ONLY=ON -DBUILD_TESTING=ON, Release): 114/114 tests pass.guest_module_dirgains two cases, run for both Linux and Windows output:--module-dir .: it is written toapp0/root.prx.guest.prx, stays out ofDT_NEEDEDon Linux, and exports__aps5_guest_initializeon Windows;DT_NEEDEDis$ORIGIN/app0/needed.prx.guest.prx.input.elf: Invalid string or symbol table), and with only the scan fix the path is$ORIGIN/app0/./root.prx.guest.prx.relinker --windows --module-dir . game/eboot.elf app.exewithlibfmod.prxnext toeboot.elf: it writesgame/app0/libfmod.prx.guest.prx. A second Linux run with the output.elfinside the module directory stops with the existing "Executable output would overwrite an input module" error. The output is deliberately not skipped by the scan, since skipping it would bypass that guard when the output path names a real module. An earlier relinked output left in a module directory is scanned like any other ELF there (true of every--module-dir), so the output belongs outside the game directory.tools/check_conventions.pyfrommainpasses on this branch with this title and body.Not tested: Windows host (the
.exerun in the test only runs on Windows) or the title itself. I don't have a Hades dump. The reporter's workaround in #2724 (copying the.guest.prxfiles toapp0/) is the layout this change produces.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)Fixes #2724